home *** CD-ROM | disk | FTP | other *** search
- <!--- this example demonstrates the use of CFABORT
- to stop the processing of a CFLOOP. Note that in
- the second example, where CFABORT is used,
- the result never appears --->
-
- <HTML>
-
- <HEAD>
- <TITLE>CFABORT Example</TITLE>
- </HEAD>
-
- <BASEFONT FACE="Arial, Helvetica" SIZE=2>
- <BODY bgcolor="#FFFFD5">
-
- <H3>CFABORT Example</H3>
-
- <P>
- <H3>Example A: Let the instruction complete itself</H3>
- <!--- first, set a variable --->
- <CFSET myVariable = 3>
- <!--- now, perform a loop that increments this value --->
- <CFLOOP FROM="1" TO="4" INDEX="Counter">
- <CFSET myVariable = myVariable + 1>
- </CFLOOP>
-
- <CFOUTPUT>
- <P> The value of myVariable after incrementing through the loop
- #Counter# times is: #myVariable#
- </CFOUTPUT>
-
-
- <!--- reset the variable and show the use of CFABORT --->
-
- <H3>Example B: Use CFABORT to halt the instruction</H3>
-
- <CFSET myVariable = 3>
- <!--- now, perform a loop that increments this value --->
- <CFLOOP FROM="1" TO="4" INDEX="Counter">
- <!--- on the second time through the loop, CFABORT --->
- <CFIF Counter is 2>
- <CFABORT>
- <!--- the processing is stopped, and subsequent operations
- are not carried out by the CFAS --->
- <CFELSE>
- <CFSET myVariable = myVariable + 1>
- </CFIF>
- </CFLOOP>
-
- <CFOUTPUT>
- <P> The value of myVariable after incrementing through the loop
- #counter# times is: #myVariable#
- </CFOUTPUT>
-
- </P>
-
- </BODY>
-
- </HTML>
-